/* @(#)GSBalanceFeeAddAction.java    V0.1
 *
 * Project: GS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-5-18
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.HashMap;

import org.apache.commons.beanutils.BeanUtils;

import com.hitrust.gs.form.GSBalanceFeeAddForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.util.GenRandNum;
import com.hitrust.gs.util.exception.GSException;
import com.hitrust.gs.business.GSBalanceFeeProcessor;
import com.hitrust.gs.bean.GSBalanceFeeBean;;

/**
 * 增加结算费用信息
 */
public class GSBalanceFeeAddAction extends GSBaseAction{

   
    public String execute(GSBaseForm aForm) throws Exception {
        GSBalanceFeeAddForm tForm = (GSBalanceFeeAddForm)aForm;
        GSBalanceFeeBean tGSBalanceFeeBean=new GSBalanceFeeBean();
        BeanUtils.copyProperties(tGSBalanceFeeBean,tForm);
        tGSBalanceFeeBean.setGs_fee_type_no(GenRandNum.genDTRandNum());
        try{
        GSBalanceFeeProcessor.addTask(tGSBalanceFeeBean);
        }
        catch(GSException err){
            HashMap tMap = new HashMap();
            tMap.put("err",err.getMessage());
            aForm.getRequest().setAttribute("_error",tMap);
            aForm.getRequest().setAttribute("message",err.getMessage());
            aForm.getRequest().setAttribute("exception_code",err.getCode());
            aForm.getRequest().setAttribute("requery","true");
            return GSBaseConstants.FORWARD_ERROR;
        }
        
        aForm.getRequest().setAttribute("message", "新增结算费用成功!");
        aForm.getRequest().setAttribute("requery","true");
        
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
